//
//  UITextField+Login.m
//  ZzzzyManProject
//
//  Created by mac on 16/3/5.
//  Copyright © 2016年 ZzzzyMan@. All rights reserved.
//

#import "UITextField+Login.h"

@implementation UITextField (Login)

+ (instancetype)loginTextFieldWith:(NSString *)placeholder andImageName:(NSString *)imageName {
    
    UITextField * textField = [[UITextField alloc] init];
    textField.background = [UIImage imageNamed:imageName];
    textField.clearButtonMode = UITextFieldViewModeAlways; //清除按钮
    textField.keyboardType = UIKeyboardTypeASCIICapable; //键盘类型
    textField.placeholder = placeholder;    //占位文本
    textField.textColor = [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1];
    
    //输入框前的间隔
    UILabel * leftView = [[UILabel alloc] initWithFrame:CGRectMake(15,0,7,26)];
    leftView.backgroundColor = [UIColor clearColor];
    textField.leftView = leftView;
    textField.leftViewMode = UITextFieldViewModeAlways;
    textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    
    return textField;
}

@end
